package com.mesd.killer.ui.cellEditor;

import java.awt.Color;
import java.awt.Component;

import javax.swing.AbstractCellEditor;
import javax.swing.JButton;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.table.TableCellEditor;

public class ButtonEditor extends  AbstractCellEditor implements TableCellEditor {
	protected JButton button;  
	 
	public ButtonEditor()
	{
		 button = new JButton(); 
		 button.setHorizontalAlignment(SwingConstants.CENTER);
		 button.setBackground( Color.white); 
	}
	
	@Override
	public Object getCellEditorValue() {
		return button.getText();
	}

	@Override
	public Component getTableCellEditorComponent(JTable table, Object value,
			boolean isSelected, int row, int column) {
		button.setText(value == null ? "" : value.toString());
		return button;
	}  

}
